summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-10-13 00:35:06 +0200
committerGitHub <noreply@github.com>2022-10-13 00:35:06 +0200
commit0b9f2c2f14fef10d8121e004a265bc3c5af93b52 (patch)
treedb32b6a0949b49b6806f246d134e6abc0b91eec5
parentMerge pull request #9024 from liamwhite/async-screenshot (diff)
parentcore_timing: use high-precision sleeps on non-Windows targets (diff)
downloadyuzu-0b9f2c2f14fef10d8121e004a265bc3c5af93b52.tar
yuzu-0b9f2c2f14fef10d8121e004a265bc3c5af93b52.tar.gz
yuzu-0b9f2c2f14fef10d8121e004a265bc3c5af93b52.tar.bz2
yuzu-0b9f2c2f14fef10d8121e004a265bc3c5af93b52.tar.lz
yuzu-0b9f2c2f14fef10d8121e004a265bc3c5af93b52.tar.xz
yuzu-0b9f2c2f14fef10d8121e004a265bc3c5af93b52.tar.zst
yuzu-0b9f2c2f14fef10d8121e004a265bc3c5af93b52.zip
-rw-r--r--src/core/core_timing.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 6c0fcb7b5..2678ce532 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -270,6 +270,7 @@ void CoreTiming::ThreadLoop() {
// There are more events left in the queue, wait until the next event.
const auto wait_time = *next_time - GetGlobalTimeNs().count();
if (wait_time > 0) {
+#ifdef _WIN32
// Assume a timer resolution of 1ms.
static constexpr s64 TimerResolutionNS = 1000000;
@@ -287,6 +288,9 @@ void CoreTiming::ThreadLoop() {
if (event.IsSet()) {
event.Reset();
}
+#else
+ event.WaitFor(std::chrono::nanoseconds(wait_time));
+#endif
}
} else {
// Queue is empty, wait until another event is scheduled and signals us to continue.